<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul id="ul">
        <li>西施</li>
        <li>貂蝉</li>
        <li>昭君</li>
        <li>凤姐</li>
        <li>芙蓉姐姐</li>
    </ul>
    <input type="button" value="按钮" id="btn" />
    <script>
        var ul = document.querySelector('ul')
        ul.onclick = function(e) {
            console.log('e.target');
            if (e.target.nodeName !== 'UL') e.target.style.backgroundColor = 'red'
        }
        ul.onmouseout = function(e) {
            console.log('e.target');
            e.target.style.backgroundColor = ''
        }
        var btn = document.querySelector('#btn')
        btn.onclick = function() {
            var lis = document.createElement('li')
            lis.innerHTML = '帅啊'
            ul.appendChild(lis)
        }
    </script>
</body>

</html>